home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1994-06-24 | 95.3 KB | 3,530 lines
/* TITLE: avm:rexx/defaultsender.avm */ /* we want results! Otherwise, we wouldn't get anything from RESULT */ options results /* Need to make sure that stdtail.avm is also included */ signal on halt signal on novalue signal on syntax signal on break_c /* needed for some of the functions we use */ call addlib("rexxsupport.library", 0, -30, 0) /* a higher than normal priority since calls are important to us :) */ call pragma('priority', 1) /* ensure that commands are directed to the correct server */ parse arg servername . address value servername parse upper arg servername mailbox magiccookie sendType . /* If type is voice, goto sendVoice. Otherwise, go to sendFax */ call loadLogEntry(mailbox, magiccookie) if log.returnNumber = '' & upper(sendType) ~= 'MANUAL' then do log.returnStatus = 'No Tel#' log.returnRetry = 0 signal sendVoiceDone end if log.filename = '' then do log.returnStatus = 'No File' log.returnRetry = 0 signal sendVoiceDone end if upper(sendType) = 'MANUAL' then numberToDial = 'MAN!'; else numberToDial = log.returnNumber if upper(log.type) = 'VOICE' then signal sendVoice else if upper(log.type) = 'FAX' then signal sendFax log.returnstatus = 'Not Voice/Fax' log.returnretry = 0 signal sendVoiceDone /* Going to send a voice file */ /* Dial up to three times */ sendVoice: numTries = 3 sendVoiceRedial: 'dial' log.returnnumber action = rc select when action = 0 then nop when action = 8 then signal sendVoiceAgain when action = 10 then signal sendVoiceAgain when action = 12 then do; log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone; end when action = 14 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end when action = 16 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end otherwise signal arexxerror end signal sendVoiceConnected sendVoiceAgain: 'requiremode' 'Voice' 'delay' 5 action = rc select when action = 0 then nop when action = 12 then do; log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone; end when action = 14 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end when action = 16 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end otherwise signal arexxerror end sendVoiceRetry: numTries = numTries - 1 if numTries <= 0 then do log.returnStatus = 'Busy' signal sendVoiceDone end signal sendVoiceRedial sendVoiceConnected: actualFileName = log.fileName if verify(actualFileName, '/:', 'M') = 0 then actualFileName = voiceFile(mailbox, actualFileName) actualAltFileName = '' if symbol('log.altFileName') = 'VAR' then actualAltFileName = log.altFileName actualAltFileName = voiceFile(mailbox, actualAltFileName) numTimes = 5 sendVoiceRepeat: if actualAltFileName = '' then signal sendVoiceSkipIntro 'playvoice' actualAltFileName action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 5 then do; log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 8 then do; if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy; end when action = 12 then do; log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone; end when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end 'flushphonebuffer' sendVoiceSkipIntro: 'playvoice' actualFileName action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 5 then do; log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 8 then do; if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy; end when action = 12 then do; log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone; end when action = 14 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end when action = 16 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end otherwise signal arexxerror end 'flushphonebuffer' sendVoiceMenu: call aapresentmenu('avm:voices/SendVoice', '019#*', '1') action = result select when action = '=0' then signal sendVoiceMenu when action = '=1' then signal sendVoiceRepeat when action = '=2' then nop when action = '=3' then nop when action = '=4' then nop when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then do; log.returnRetry = 0; log.returnStatus = 'Sent+'; call updateLogEntry(mailbox, magicCookie); call aamaintenancemode(log.origmailbox); signal answerVoiceDone; end when action = '=#' then signal answerVoiceDone when action = '=*' then signal sendVoiceOK when action = 4 then do; log.returnStatus = 'Fax?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 5 then do; log.returnStatus = 'Data?'; log.returnRetry = 0; signal sendVoiceDone; end when action = 8 then do; if numTimes = 3 then signal sendVoiceAgain; else signal sendVoiceBusy; end when action = 10 then nop when action = 12 then do; log.returnStatus = 'Abort'; log.returnRetry = 0; signal sendVoiceDone; end when action = 14 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end when action = 16 then do; log.returnStatus = 'Error'; log.returnRetry = 0; signal sendVoiceDone; end otherwise signal arexxerror end numTimes = numTimes - 1 if numTimes <= 0 then do signal sendVoiceTimedOut end signal sendVoiceRepeat sendVoiceTimedOut: log.returnStatus = 'Sent-TimedOut' log.returnRetry = 0 signal sendVoiceDone sendVoiceBusy: log.returnRetry = 0 log.returnStatus = 'Sent-Busy' signal sendVoiceDone sendVoiceOK: log.returnRetry = 0 log.returnStatus = 'Sent+' sendVoiceDone: if log.returnRetry > 0 then do log.returnRetry = log.returnRetry - 1 log.time = cTime() + log.returnInterval * 60 end call updateLogEntry(mailbox, magicCookie) exit startup: /* Pressing 0 usually gets us here */ answerVoiceDone: /* Pressing * gets us here */ exit /* Going to send a fax file */ sendFax: options failat 50 signal off syntax 'requiremode' 'Command' 'setserial' '19200' '8' 'N' '1' '7Wire' action = rc select when action = 0 then nop when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end 'assumemode' 'Unknown' isTrapFax: faxprogram = getclip('AVMFaxProgram') if upper(faxprogram) = 'TRAPFAX' then do mypara = 'File ' || log.filename || ' call ' || log.returnnumber address command 'TrapFax:TFaxDoor >NIL:' mypara ' noowndev' sendok = rc log.returnstatus = 'Error' isGPFax: end; else if upper(faxprogram) = 'GPFAX' & show('p', 'REXX_GPFAX') then do address rexx_gpfax 'listen' address rexx_gpfax 'sendfax' log.filename 'to' log.returnnumber sendok = rc address rexx_gpfax 'reportlog' 'T' 3 log.returnstatus = result address rexx_gpfax 'unlisten' isEFax: end; else if upper(faxprogram) = 'EFAX' then do /* now we need to find all files that match */ toSend = '' base = upper(voiceFile(mailbox, log.fileName) || '.'); do i = 1 to 999 if exists(base || right(i, 3, '0')) then toSend = toSend base || right(i, 3, '0') else break end address command 'avm:gnu/efax -p' servername '-t' '"' || compress(numberToDial) || '"' toSend if rc = 0 then sendOK = 0 else sendOK = 10 isNeither: end; else do log.returnStatus = 'Fax Prog?' log.returnRetry = 0 call updateLogEntry(mailbox, magiccookie) end sendFaxDone: if sendok < 5 then do; log.returnretry = 0; log.returnstatus = 'Sent OK'; end else do; log.returnRetry = log.returnRetry - 1; log.time = cTime() + log.returnInterval * 60; end call updateLogEntry(mailbox, magiccookie) 'delay' 5 action = rc select when action = 0 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'writeline' 'AT+FCLASS=0' 'readline' '2' action = rc if action = 0 then value = result select when action = 0 then nop when action = 10 then signal stdtimedout when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'readline' '2' action = rc if action = 0 then value = result select when action = 0 then nop when action = 10 then signal stdtimedout when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end /* We're done sending a fax */ exit /* TITLE: avm:rexx/stdtail.avm */ /* This is the standard tail */ exit exit mailboxDir: procedure parse arg mailbox return 'avm:' || mailbox || '/' logFile: procedure parse arg mailbox, magiccookie return 'avm:' || mailbox || '/logs/' || magiccookie voiceFile: procedure parse arg mailbox, magiccookie if (verify(magiccookie, '/:', 'M') = 0) then return 'avm:' || mailbox || '/voices/' || magiccookie else return magiccookie makeUniqueFile: procedure if arg() ~= 0 then do rc = "makeUniqueFile: bad args" signal error end return address() || '.' || date('i') || '.' || time('s') || '.' || random(1, 999, time('s')) convertToDate: procedure if arg() ~= 1 then do rc = "convertToDate: bad args" signal error end parse arg timeInC actualTime = (timeInC - (2922)*86400) // (86400) actualDate = (timeInC - actualTime - 2922*86400) % 86400 return actualDate /* returning it in 'internal' format */ convertToTime: procedure if arg() ~= 1 then do rc = "convertToTime: bad args" signal error end parse arg timeInC actualTime = (timeInC - (2922)*86400) // (86400) return actualTime cTime: procedure /* 2922 = 8*365 + 2 */ /* 86400 = 24*60*60 */ return (date('i')+2922)*86400 + time('s') /* this returns a handle that you must use after initializing log. */ initLogEntry: procedure expose log. if arg() ~= 0 then do rc = "initLogEntry: bad args" signal error end drop log. log. = '' acidname = getclip(address() || 'CIDNAME') acidnumber = getclip(address() || 'CIDNUMBER') /* 2922 = 8*365 + 2 */ /* 86400 = 24*60*60 */ log.time = (date('i')+2922)*86400 + time('s') log.cidname = acidname log.cidnumber = acidnumber return loadLogEntry: procedure expose log. if arg() ~= 2 then do rc = "loadLogEntry: bad args" signal error end parse arg mailbox, handle drop log. log. = '' if ~exists(mailboxDir(mailbox)) then do call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist') return end opened = open(handle, logFile(mailbox, handle), 'r') if opened then do call showDebugger('Loading entry' logFile(mailbox, handle)) do while ~eof(handle) line = readln(handle) parse upper var line variable '=' value log.variable = value end call close(handle) end; else call showDebugger('Could not load' logFile(mailbox, handle)) return /* pass a handle here */ saveLogEntry: procedure expose log. if arg() ~= 2 then do rc = "saveLogEntry: bad args" signal error end parse arg mailbox, handle if ~exists(mailboxDir(mailbox)) then do call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist') return end opened = open(handle, logFile(mailbox, handle), 'w') if opened then do call showDebugger('Saving entry' logFile(mailbox, handle)) call writeln(handle, 'TYPE=' || log.type) call writeln(handle, 'TIME=' || log.time) call writeln(handle, 'LENGTH=' || log.length) call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox) call writeln(handle, 'CIDNAME=' || log.cidname) call writeln(handle, 'CIDNUMBER=' || log.cidnumber) call writeln(handle, 'COMMENT=' || log.comment) call writeln(handle, 'FILENAME=' || log.filename) call writeln(handle, 'ALTFILENAME=' || log.altfilename) call writeln(handle, 'RETURNNUMBER=' || log.returnnumber) call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc) call writeln(handle, 'RETURNSTATUS=' || log.returnstatus) call writeln(handle, 'RETURNRETRY=' || log.returnretry) call writeln(handle, 'RETURNINTERVAL=' || log.returninterval) call close(handle) address rexx 'broadcast' 'addtomailbox' mailbox handle end; else call showDebugger('Could not save' logFile(mailbox, handle)) return /* pass a handle here */ updateLogEntry: procedure expose log. if arg() ~= 2 then do rc = "updateLogEntry: bad args" signal error end parse arg mailbox, handle if ~exists(mailboxDir(mailbox)) then do call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist') return end if ~exists(logFile(mailbox, handle)) then do call showDebugger('Unable to update non-existent' logFile(mailbox, handle)) return end opened = open(handle, logFile(mailbox, handle), 'w') if opened then do call showDebugger('Updating entry' logFile(mailbox, handle)) call writeln(handle, 'TYPE=' || log.type) call writeln(handle, 'TIME=' || log.time) call writeln(handle, 'LENGTH=' || log.length) call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox) call writeln(handle, 'CIDNAME=' || log.cidname) call writeln(handle, 'CIDNUMBER=' || log.cidnumber) call writeln(handle, 'COMMENT=' || log.comment) call writeln(handle, 'FILENAME=' || log.filename) call writeln(handle, 'ALTFILENAME=' || log.altfilename) call writeln(handle, 'RETURNNUMBER=' || log.returnnumber) call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc) call writeln(handle, 'RETURNSTATUS=' || log.returnstatus) call writeln(handle, 'RETURNRETRY=' || log.returnretry) call writeln(handle, 'RETURNINTERVAL=' || log.returninterval) call close(handle) address rexx 'broadcast' 'refreshmailboxentry' mailbox handle end; else call showDebugger('Could not update' logFile(mailbox, handle)) return showDebugger: procedure if arg() ~= 1 then do say "showDebugger: ERROR" exit 20 end parse arg debuggerInfo firstLine = sourceline(1) parse var firstLine '/*' 'TITLE:' title '*/' if showlist('p', 'AVMLOGGER') then address 'AVMLOGGER' 'add' title ':' debuggerInfo else say title ':' debuggerInfo return /*-----------------------------------------------------------------------*/ /* signal processing */ arexxerror: error: call showDebugger("Error" rc "at line" sigl) exit 20 break_c: halt: call showDebugger("Halt/Break_C at line" sigl) exit 20 novalue: call showDebugger("No value at line" sigl) exit 20 syntax: call showDebugger("Syntax error" rc "at line" sigl) exit 20 exit /* this requires logfunctions.avm */ loadMailbox: procedure expose mailbox. if arg() ~= 1 then do rc = "loadMailbox: bad args" signal error end mailbox. = '' parse arg mailbox handle = 'mailboxconfig' opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'r') if opened then do do while ~eof(handle) line = readln(handle) parse upper var line variable '=' value mailbox.variable = value end call close(handle) end return /* pass a handle here */ saveMailbox: procedure expose mailbox. if arg() ~= 1 then do rc = "saveMailbox: bad args" signal error end parse arg mailbox handle = 'mailboxconfig' opened = open(handle, mailboxDir(mailbox) || 'mailbox.cfg', 'w') if opened then do call writeln(handle, 'PASSWORD=' || mailbox.password) call writeln(handle, 'AUTOFAXFORWARDB=' || mailbox.autofaxforwardb) call writeln(handle, 'AUTOFAXFORWARD=' || mailbox.autofaxforward) call writeln(handle, 'AUTOFAXFORWARDSCRIPT=' || mailbox.autofaxforwardscript) call writeln(handle, 'AUTOFORWARDB=' || mailbox.autoforwardb) call writeln(handle, 'AUTOFORWARDONDEMAND=' || mailbox.autoforwardondemand) call writeln(handle, 'AUTOFORWARD=' || mailbox.autoforward) call writeln(handle, 'AUTOFORWARDSCRIPT=' || mailbox.autoforwardscript) call writeln(handle, 'AUTOPAGEB=' || mailbox.autopageb) call writeln(handle, 'AUTOPAGEONDEMAND=' || mailbox.autopageondemand) call writeln(handle, 'AUTOPAGE=' || mailbox.autopage) call writeln(handle, 'AUTOPAGESCRIPT=' || mailbox.autopagescript) call writeln(handle, 'AUTOALERTB=' || mailbox.autoalertb) call writeln(handle, 'AUTOALERTONDEMAND=' || mailbox.autoalertondemand) call writeln(handle, 'AUTOALERTSCRIPT=' || mailbox.autoalertscript) call close(handle) end return /* TITLE: avm:rexx/getnumber.avm */ getnumber: procedure aagetnumberagain: 'playvoice' 'avm:voices/GetNumber' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'readkeysuntil' '#' '15' '7' action = rc if action = 0 then value = result select when action = 0 then do; number = value; end when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then do; number = ''; end when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'playvoice' 'avm:voices/NumberEntered' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playNumber(number) aagetnumbermenu: call aapresentmenu('avm:voices/numbercorrect', '02#*', '3') action = result select when action = '=0' then signal aagetnumbermenu when action = '=1' then nop when action = '=2' then signal aagetnumberagain when action = '=3' then nop when action = '=4' then nop when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then signal aagetnumberdone when action = '=*' then signal answerVoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then do; number = ''; signal aagetnumberdone; end when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end aagetnumberdone: /* We're done. Number is in 'number' */ return number /* TITLE: avm:rexx/playnumber.avm */ playnumber: /* Cycle through value and play each symbol */ procedure parse arg number say 'playnumber' number do i = 1 to length(number) if pos(substr(number, i, 1), '0123456789') > 0 then call playnumbranch('playnum' || substr(number, i, 1)) else if substr(number, i, 1) = '#' then call playnumbranch('playnumpound') else if substr(number, i, 1) = '*' then call playnumbranch('playnumstar') end signal playnumdone playnumbranch: procedure parse arg label signal value label return playnum0: 'playvoice' 'avm:voices/number00' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum1: 'playvoice' 'avm:voices/number01' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum2: 'playvoice' 'avm:voices/number02' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum3: 'playvoice' 'avm:voices/number03' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum4: 'playvoice' 'avm:voices/number04' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum5: 'playvoice' 'avm:voices/number05' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum6: 'playvoice' 'avm:voices/number06' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum7: 'playvoice' 'avm:voices/number07' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum8: 'playvoice' 'avm:voices/number08' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum9: 'playvoice' 'avm:voices/number09' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnumpound: 'playvoice' 'avm:voices/numberpound' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnumstar: 'playvoice' 'avm:voices/numberstar' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnumdone: /* We're done */ return /* TITLE: avm:rexx/playddnumber.avm */ playddnumber: /* We're going to play a double digit number */ procedure parse arg number directdd = getclip('AVMDirectDDNumber') if upper(directdd) = 'YES' then signal playdirectdd if number > 9 & number < 20 then call playnumbranch('playnum' || number) else if number >= 20 & number < 60 then do units = number // 10 tens = number - units call playnumbranch('playnum' || tens) if units > 0 then call playnumbranch('playnum' || units) end; else call playnumber(number) signal playddnumdone playdirectdd: if number < 10 then call playnumber(number) else call playnumbranch('playnum' || number) signal playddnumdone playnum10: 'playvoice' 'avm:voices/number10' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum11: 'playvoice' 'avm:voices/number11' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum12: 'playvoice' 'avm:voices/number12' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum13: 'playvoice' 'avm:voices/number13' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum14: 'playvoice' 'avm:voices/number14' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum15: 'playvoice' 'avm:voices/number15' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum16: 'playvoice' 'avm:voices/number16' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum17: 'playvoice' 'avm:voices/number17' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum18: 'playvoice' 'avm:voices/number18' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum19: 'playvoice' 'avm:voices/number19' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum20: 'playvoice' 'avm:voices/number20' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum30: 'playvoice' 'avm:voices/number30' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum40: 'playvoice' 'avm:voices/number40' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum50: 'playvoice' 'avm:voices/number50' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playddnumdone: /* We're done */ return playnum21: 'playvoice' 'avm:voices/number21' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum22: 'playvoice' 'avm:voices/number22' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum23: 'playvoice' 'avm:voices/number23' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum24: 'playvoice' 'avm:voices/number24' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum25: 'playvoice' 'avm:voices/number25' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum26: 'playvoice' 'avm:voices/number26' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum27: 'playvoice' 'avm:voices/number27' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum28: 'playvoice' 'avm:voices/number28' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum29: 'playvoice' 'avm:voices/number29' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum31: 'playvoice' 'avm:voices/number31' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum32: 'playvoice' 'avm:voices/number32' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum33: 'playvoice' 'avm:voices/number33' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum34: 'playvoice' 'avm:voices/number34' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum35: 'playvoice' 'avm:voices/number35' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum36: 'playvoice' 'avm:voices/number36' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum37: 'playvoice' 'avm:voices/number37' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum38: 'playvoice' 'avm:voices/number38' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum39: 'playvoice' 'avm:voices/number39' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum41: 'playvoice' 'avm:voices/number41' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum42: 'playvoice' 'avm:voices/number42' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum43: 'playvoice' 'avm:voices/number43' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum44: 'playvoice' 'avm:voices/number44' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum45: 'playvoice' 'avm:voices/number45' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum46: 'playvoice' 'avm:voices/number46' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum47: 'playvoice' 'avm:voices/number47' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum48: 'playvoice' 'avm:voices/number48' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum49: 'playvoice' 'avm:voices/number49' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum51: 'playvoice' 'avm:voices/number51' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum52: 'playvoice' 'avm:voices/number52' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum53: 'playvoice' 'avm:voices/number53' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum54: 'playvoice' 'avm:voices/number54' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum55: 'playvoice' 'avm:voices/number55' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum56: 'playvoice' 'avm:voices/number56' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum57: 'playvoice' 'avm:voices/number57' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum58: 'playvoice' 'avm:voices/number58' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playnum59: 'playvoice' 'avm:voices/number59' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return /* TITLE: avm:rexx/playtime.avm */ playtime: procedure parse arg secs hours = secs % (60*60) minutes = (secs - (hours * 60 * 60)) % 60 if hours < 12 then pm = 0 else do; pm = 1; hours = hours - 12; end if hours = 0 then hours = 12 timeformat = getclip('AVMTimeFormat') if timeformat = "" then timeformat = '%hours12 %minutes %pm' do i = 1 to words(timeformat) if upper(word(timeformat, i)) = '%HOURS12' then call playddnumber(hours) else if upper(word(timeformat, i)) = '%HOURS24' then call playddnumber(hours + (pm * 12)) else if upper(word(timeformat, i)) = '%MINUTES' then call playddnumber(minutes) else if upper(word(timeformat, i)) = '%PM' then do if pm then call playnumbranch('playtimepm') else call playnumbranch('playtimeam') end else call playddvoice(word(timeformat, i)) end /* We're done */ return playtimeam: 'playvoice' 'avm:voices/timeam' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playtimepm: 'playvoice' 'avm:voices/timepm' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return /* TITLE: avm:rexx/playdate.avm */ playdate: /* We're going to play the month and day */ procedure parse arg actualDate dateformat = getclip('AVMDateFormat') if dateformat = "" then dateformat = "%month %day" else if upper(dateformat) = "NONE" then dateformat = "" do i = 1 to words(dateformat) if upper(word(dateformat, i)) = "%MONTH" then call playnumbranch('playdate' || substr(actualDate, 5, 2)) else if upper(word(dateformat, i)) = "%DAY" then call playddnumber(substr(actualDate, 7, 2)) else call playddvoice(word(dateformat, i)) end /* We're done */ return playddvoice: procedure parse arg filename 'playvoice' filename action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate01: 'playvoice' 'avm:voices/monthjanuary' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate02: 'playvoice' 'avm:voices/monthfebruary' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate03: 'playvoice' 'avm:voices/monthmarch' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate04: 'playvoice' 'avm:voices/monthapril' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate05: 'playvoice' 'avm:voices/monthmay' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate06: 'playvoice' 'avm:voices/monthjune' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate07: 'playvoice' 'avm:voices/monthjuly' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate08: 'playvoice' 'avm:voices/monthaugust' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate09: 'playvoice' 'avm:voices/monthseptember' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate10: 'playvoice' 'avm:voices/monthoctober' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate11: 'playvoice' 'avm:voices/monthnovember' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return playdate12: 'playvoice' 'avm:voices/monthdecember' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return /* TITLE: avm:rexx/recordmessage.avm */ recordmessage: procedure parse arg filename recordmessagesagain: call aapresentmenu('avm:voices/RecordMessage', '0123#*', '3') action = result select when action = '=0' then signal recordmessageagain when action = '=1' then signal recordmessagesplay when action = '=2' then signal recordmessagesrecord when action = '=3' then signal recordmessagesdelete when action = '=4' then nop when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; nop; end when action = '=*' then signal answerVoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return recordmessagesplay: 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'playvoice' filename action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end 'flushphonebuffer' 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal recordmessagesagain recordmessagesrecord: 'playvoice' 'avm:voices/RecordMessagesRecord' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'recordvoice' '0' '-1' '30' filename action = rc select when action = 0 then nop when action = 1 then nop when action = 2 then nop when action = 3 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'flushphonebuffer' 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal recordmessagesagain recordmessagesdelete: address command 'delete >nil: <nil: quiet' filename signal recordmessagesagain aapresentmenu: /* TITLE: avm:rexx/presentmenu.avm */ procedure expose pmRetries pmTimesAround parse arg filename, valid, retries timesaround = retries pmTimesAround = timesaround pmRetries = retries rs.normal = 0 rs.keydetected = 1 rs.quietdetected = 2 rs.silencedetected = 3 rs.faxdetected = 4 rs.datadetected = 5 rs.busydetected = 8 rs.timedout = 10 rs.signaldetected = 12 rs.overflow = 14 rs.error = 16 /* CB 0000 */ aapresentmenuloop: 'playvoice' filename action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; return rs.faxdetected; end when action = 5 then do; return rs.datadetected; end when action = 8 then do; return rs.busydetected; end when action = 12 then do; return rs.signaldetected; end when action = 14 then do; return rs.error; end when action = 16 then do; return rs.error; end otherwise signal arexxerror end 'readnkeys' '1' '5' action = rc if action = 0 then value = result select when action = 0 then signal aapresentmenuvalue when action = 4 then do; return rs.faxdetected; end when action = 5 then do; return rs.datadetected; end when action = 8 then do; return rs.busydetected; end when action = 10 then signal aapresentmenutimeout when action = 12 then do; return rs.signaldetected; end when action = 14 then do; return rs.error; end when action = 16 then do; return rs.error; end otherwise signal arexxerror end return rs.error aapresentmenutimeout: 'flushphonebuffer' 'playvoice' 'avm:voices/TimedOut' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; return rs.faxdetected; end when action = 5 then do; return rs.datadetected; end when action = 8 then do; return rs.busydetected; end when action = 12 then do; return rs.signaldetected; end when action = 14 then do; return rs.error; end when action = 16 then do; return rs.error; end otherwise signal arexxerror end timesaround = timesaround - 1; pmTimesAround = timesaround if timesaround <= 0 then return rs.timedout signal aapresentmenuloop aapresentmenuvalue: if pos(value, valid) = 0 then signal aainvalid return '=' || value aainvalid: 'flushphonebuffer' 'playvoice' 'avm:voices/BadChoice' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; return rs.faxdetected; end when action = 5 then do; return rs.datadetected; end when action = 8 then do; return rs.busydetected; end when action = 12 then do; return rs.signaldetected; end when action = 14 then do; return rs.error; end when action = 16 then do; return rs.error; end otherwise signal arexxerror end timesaround = timesaround - 1; pmTimesAround = timesaround if timesaround <= 0 then return rs.timedout signal aapresentmenuloop aaprocessmailbox: /* TITLE: avm:rexx/processmailbox.avm */ /* Function which has one argument, the mailbox */ procedure expose acidname acidnumber mailbox faxscript datascript parse arg mailbox . call loadMailBox(mailbox) calledSysop = 0 pagedSysop = 0 if mailbox.autoalertb = 1 & mailbox.autoalertscript ~= '' then address rexx 'alertsysop' mailbox 'playvoice' voiceFile(mailbox,'Personal') action = rc select when action = 0 then nop when action = 1 then signal aakeypressed when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end aaAnnounce: if mailbox.autoforwardannounce = 1 & mailbox.autoforward ~= '' then call announceForwardNumber aanopersonal: 'playvoice' 'avm:voices/MailboxGreeting' action = rc select when action = 0 then nop when action = 1 then signal aakeypressed when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end /* Init log file stuff */ aaskipinstructions: handle = makeUniqueFile() call initLogEntry() call time('r') userBeep = getclip('AVMUserBeep') if userBeep = 'YES' then do 'playvoice' 'avm:voices/UserBeep' action = rc select when action = 0 then nop when action = 1 then signal aakeypressed when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end end; else do 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end end 'recordvoice' '0' '-1' '-1' voiceFile(mailbox,handle) action = rc select when action = 0 then nop when action = 1 then do; call aafixlog; signal aakeypressedafterrecord; end when action = 2 then do; call aafixlog; signal stdabort; end when action = 3 then do; call aafixlog; if upper(getclip('AVMDataAfterSilence')) = 'YES' then signal stddata; else signal stdabort; end when action = 4 then do; call aafixlog; signal stdfax; end when action = 5 then do; call aafixlog; signal stddata; end when action = 8 then do; call aafixlog; signal stdbusy; end when action = 10 then do; call aafixlog; signal aakeypressedafterrecord; end when action = 12 then do; call aafixlog; signal stdabort; end when action = 14 then do; call aafixlog; signal stderror; end when action = 16 then do; call aafixlog; signal stderror; end otherwise signal arexxerror end /* Shouldn't get here */ signal stderror aafixlog: /* This writes out the log file */ if mailbox.autoforwardb = 1 & mailbox.autoforwardondemand = "" & calledSysop = 0 then do call aaCallSysop end if mailbox.autopageb = 1 & mailbox.autopageondemand = "" & pagedSysop = 0 then do call aaPageSysop end log.filename = handle log.length = trunc(time('e')) log.type = 'voice' call saveLogEntry(mailbox, handle) preConv = upper(getclip('AVMPreConvert')) if preConv = 'YES' then address command 'run >nil: <nil: avm:adpcm2iff' , voiceFile(mailbox, handle) voiceFile(mailbox, handle) || 'i' '-nogui -1second' return aakeypressedafterrecord: 'flushphonebuffer' processmailboxmenu: call aapresentmenu('avm:voices/MailboxCaller', '012345679#*', '3') action = result select when action = '=0' then signal processmailboxmenu when action = '=1' then signal aaAnnounce when action = '=2' then signal stdfaxinstruct when action = '=3' then do; call aaleavenumber(); end when action = '=4' then do; good = getpassword(mailbox.autoalertondemand); if good then address rexx 'alertsysop' mailbox; end when action = '=5' then signal stddatainstruct when action = '=6' then do; good = getpassword(mailbox.autoforwardondemand); if good & calledSysop = 0 then call aaCallSysop(); end when action = '=7' then do; good = getpassword(mailbox.autopageondemand); if good & pagedSysop = 0 then call aaPageSysop(); end when action = '=8' then nop when action = '=9' then do; call aamaintenancemode(mailbox); end when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answervoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal processmailboxmenu /* Shouldn't get here */ signal stderror aaleavenumber: number = getNumber() log.returnnumber = number call updateLogEntry(mailbox, handle) return aakeypressed: call aapresentmenu('avm:voices/SkipFaxMaintenance', '012359#*', '3') action = result select when action = '=0' then signal aakeypressed when action = '=1' then signal aaskipinstructions when action = '=2' then signal stdfaxinstruct when action = '=3' then signal aaAnnounce when action = '=4' then nop when action = '=5' then signal stddatainstruct when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then do; call aamaintenancemode(mailbox); end when action = '=#' then do; return; end when action = '=*' then signal stdabort when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answervoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return /* TITLE: avm:rexx/maintenancemode.avm */ aamaintenancemode: procedure parse arg mailbox . call loadMailbox(mailbox) good = getPassword(mailbox.password) if good = 0 then signal answerVoiceDone logsthis = words(showdir(logFile(mailbox, ''))) logsanonymous = words(showdir(logFile('anonymous', ''))) if upper(mailbox) = 'ANONYMOUS' then logsanonymous = 0 if logsthis > 0 then call sayCountEntries(logsthis, 0) if logsanonymous > 0 then call sayCountEntries(logsanonymous, 1) maintenanceModeAgain: call aapresentmenu('avm:voices/maintenancemode', '01234567#*', '3') action = result select when action = '=0' then signal maintenanceModeAgain when action = '=1' then do; call retrievemessages(mailbox); end when action = '=2' then do; call recordMessage(voiceFile(mailbox, 'Personal')); end when action = '=3' then do; call changeintrooptions(); end when action = '=4' then do; call changepassword(); end when action = '=5' then do; call sendMessageTo('Outgoing', mailbox, '', makeUniqueFile(), 'Voice', voiceFile(mailbox, 'Introduction'), '', ''); end when action = '=6' then do; call changeautooptions(mailbox); end when action = '=7' then do; call aaretrievemessages('Outgoing', 1, mailbox); end when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal maintenanceModeAgain /* TITLE: avm:rexx/getpassword.avm */ /* This is a procedure which accepts 1 argument, a password */ getpassword: procedure parse arg password count = 3 /* max of 3 times */ if password = '' then return 1 getpasswordagain: count = count - 1 if count = 0 then return 0 /* didn't get a good password */ 'playvoice' 'avm:voices/getpassword' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'readkeysuntil' '#' '10' '7' action = rc if action = 0 then value = result select when action = 0 then signal getpasskeydetected when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'playvoice' 'avm:voices/passwordtimeout' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal getpasswordagain getpasskeydetected: if value = password then return 1 'playvoice' 'avm:voices/passwordbad' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal getpasswordagain retrievemessages: procedure parse arg mailbox . call aaretrievemessages(mailbox, 0, mailbox) if upper(mailbox) = 'ANONYMOUS' then return 'playvoice' 'avm:voices/retrieveanonymous' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call aaretrievemessages('Anonymous', 0, mailbox) 'playvoice' 'avm:voices/backhome' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return changepassword: number = getNumber() if number ~= '' then do mailbox.password = number call saveMailbox(mailbox) end return sayCountEntries: parse arg count, inAnon if count = 1 & inAnon then signal say1Anon else if count = 1 & inAnon = 0 then signal say1This sayCountMultiple: 'playvoice' 'avm:voices/ThereAre' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playddnumber(count) if inAnon then signal sayCountAnon else signal sayCountThis sayCountAnon: 'playvoice' 'avm:voices/InAnonMailbox' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return sayCountThis: 'playvoice' 'avm:voices/InThisMailbox' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return say1Anon: 'playvoice' 'avm:voices/OneInAnonMailbox' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return say1This: 'playvoice' 'avm:voices/OneInThisMailbox' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return changeintrooptions: call aapresentmenu('avm:voices/changeintrooptions', '012345#*', '3') action = result select when action = '=0' then signal changeintrooptions when action = '=1' then do; call setclip('AVMIntroductionType', 'DAYOFWEEK'); end when action = '=2' then do; call setclip('AVMIntroductionType', 'TIMEOFDAY'); end when action = '=3' then do; call setclip('AVMIntroductionType', 'RANDOM'); end when action = '=4' then do; call changetomanual(); end when action = '=5' then do; call recordintro(); end when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal changeintrooptions changetomanual: call aapresentmenu('avm:voices/selectmanualintro', '01234567#*', '3') action = result select when action = '=0' then signal changetomanual when action = '=1' then do; call setclip('AVMIntroductionType', '1'); end when action = '=2' then do; call setclip('AVMIntroductionType', '2'); end when action = '=3' then do; call setclip('AVMIntroductionType', '3'); end when action = '=4' then do; call setclip('AVMIntroductionType', '4'); end when action = '=5' then do; call setclip('AVMIntroductionType', '5'); end when action = '=6' then do; call setclip('AVMIntroductionType', '6'); end when action = '=7' then do; call setclip('AVMIntroductionType', '7'); end when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal changetomanual recordintro: call aapresentmenu('avm:voices/recordintro', '01234567#*', '3') action = result select when action = '=0' then signal recordintro when action = '=1' then do; call recordmessage('avm:voices/intro1'); end when action = '=2' then do; call recordmessage('avm:voices/intro2'); end when action = '=3' then do; call recordmessage('avm:voices/intro3'); end when action = '=4' then do; call recordmessage('avm:voices/intro4'); end when action = '=5' then do; call recordmessage('avm:voices/intro5'); end when action = '=6' then do; call recordmessage('avm:voices/intro6'); end when action = '=7' then do; call recordmessage('avm:voices/intro7'); end when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal recordintro changeautooptions: procedure parse arg mailbox . call loadMailbox(mailbox) changeautomenu: call aapresentmenu('avm:voices/ChangeAutoOptions', '0123#*', '3') action = result select when action = '=0' then signal changeautomenu when action = '=1' then do; call editautooptions('AUTOFORWARDB', 'AUTOFORWARDONDEMAND', 'AUTOFORWARD', 'AUTOFORWARDANNOUNCE'); end when action = '=2' then do; call editautooptions('AUTOFAXFORWARDB', '', 'AUTOFAXFORWARD', ''); end when action = '=3' then do; call editautooptions('AUTOPAGEB', 'AUTOPAGEONDEMAND', 'AUTOPAGE', ''); end when action = '=4' then nop when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answerVoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal changeautomenu editautooptions: procedure expose mailbox. mailbox parse arg isOn, onDemand, telNumber, announce call showAutoOptions editautomenu: call aapresentmenu('avm:voices/AutoOptions', '01234567#*', '3') action = result select when action = '=0' then signal editautomenu when action = '=1' then do; mailbox.isOn = 1; call saveMailbox(mailbox); end when action = '=2' then do; mailbox.isOn = 0; call saveMailbox(mailbox); end when action = '=3' then do; mailbox.telNumber = getNumber(); call saveMailbox(mailbox); end when action = '=4' then do; if onDemand ~= '' then do; mailbox.onDemand = getNumber(); call saveMailbox(mailbox); end; end when action = '=5' then do; if announce ~= '' then do; mailbox.announce = 1; call saveMailbox(mailbox); end; end when action = '=6' then do; if announce ~= '' then do; mailbox.announce = 0; call saveMailbox(mailbox); end; end when action = '=7' then do; call showAutoOptions(); end when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answerVoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal editautomenu showautooptions: if mailbox.isOn = 1 then call autoIsOn(); else call autoIsOff() if onDemand ~= '' then call autoOnDemand(mailbox.onDemand) call autoTelNumber(mailbox.telNumber) if announce ~= '' then if mailbox.announce = 1 then call announceIsOn(); else call announceIsOff() return autoIsOn: 'playvoice' 'avm:voices/AutoIsOn' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'flushphonebuffer' return autoIsOff: 'playvoice' 'avm:voices/autoIsOff' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'flushphonebuffer' return announceIsOn: 'playvoice' 'avm:voices/AnnounceIsOn' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'flushphonebuffer' return announceIsOff: 'playvoice' 'avm:voices/AnnounceIsOff' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'flushphonebuffer' return autoOnDemand: procedure parse arg number 'playvoice' 'avm:voices/AutoOnDemand' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playNumber(number) 'flushphonebuffer' return autoTelNumber: procedure parse arg number 'playvoice' 'avm:voices/AutoTelNumber' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playNumber(number) 'flushphonebuffer' return /* TITLE: avm:rexx/retrievemessages.avm */ aaretrievemessages: procedure parse arg mailbox, isOutgoing, whichMailbox logs = showdir(logFile(mailbox, '')) numlogs = words(logs) currentlog = 1 retrievemessagesnext: if currentlog > numlogs then signal retrievemessagesdone currentHandle = word(logs, currentLog) call loadLogEntry(mailbox, currentHandle) if (isOutgoing & ( log.returnRetry = '' | log.returnRetry = 0 | (upper(log.origMailbox) ~= upper(whichMailbox) & upper(log.origMailbox) ~= 'ANONYMOUS'))) then do currentLog = currentLog + 1 signal retrieveMessagesNext end retrievemessagesagain: logtype = upper(log.type) if logtype = 'FAX' then signal isfax else if logtype = 'VOICE' then signal isvoice else signal isunknown isfax: 'playvoice' 'avm:voices/FaxMessage' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal aftertype isvoice: 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then nop when action = 5 then nop when action = 8 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end 'playvoice' voiceFile(mailbox, log.filename) action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then nop when action = 5 then nop when action = 8 then nop when action = 12 then signal stdabort when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end 'flushphonebuffer' 'playbeep' '3000' '0' '4' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then nop when action = 5 then nop when action = 8 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal aftertype isunknown: 'playvoice' 'avm:voices/UnknownMessage' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal aftertype aftertype: call aapresentmenu('avm:voices/RetrieveMessages', '012345678#*', '3') action = result select when action = '=0' then signal aftertype when action = '=1' then signal retrievemessagesagain when action = '=2' then do; call playtimedate(); end when action = '=3' then do; call playtelcidnumber(); end when action = '=4' then signal processNextMessage when action = '=5' then do; address rexx 'delete' mailbox currentHandle; signal processNextMessage; end when action = '=6' then do; if isOutgoing = 0 then address rexx 'archive' mailbox currentHandle; else address rexx 'archiveoutgoing' mailbox currentHandle; signal processNextMessage; end when action = '=7' then do; call forwardmessage(mailbox, currentHandle); end when action = '=8' then do; call replymessage(mailbox, currentHandle); end when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then signal answervoiceDone when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 10 then signal answerVoiceDone when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end signal aftertype processNextMessage: currentLog = currentLog + 1 signal retrievemessagesnext playtimedate: actualTime = convertToTime(log.time) actualDate = convertToDate(log.time) call playTime(actualTime) actualDate = date('s', actualDate) /* convert to sorted */ call playDate(actualDate) 'flushphonebuffer' return playtelcidnumber: 'playvoice' 'avm:voices/cidnumber' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end if symbol('log.cidnumber') = 'VAR' then call playNumber(log.cidnumber) 'flushphonebuffer' 'playvoice' 'avm:voices/returnnumber' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end if symbol('log.returnnumber') = 'VAR' then call playNumber(log.returnnumber) 'flushphonebuffer' return retrievemessagesdone: 'playvoice' 'avm:voices/NoMoreMessages' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return replyMessage: procedure parse arg mailbox, magicCookie call loadLogEntry(mailbox, magicCookie) number = log.returnNumber if number = '' then number = log.cidNumber handle = makeUniqueFile() sent = sendMessageTo('Outgoing', mailbox, number, handle, 'Voice', voiceFile(mailbox, 'Introduction'), log.cidNumber, log.cidName) return forwardMessage: procedure parse arg mailbox, magicCookie call loadLogEntry(mailbox, magicCookie) if verify(log.fileName, '/:', 'M') = 0 then address command 'copy >nil: <nil:' voiceFile(mailbox, log.fileName) || '#?' voiceFile('Outgoing', '') sent = sendMessageTo('Outgoing', mailbox, '', log.fileName, log.type, voiceFile(mailbox, 'Introduction'), log.cidName, log.cidNumber) return /* TITLE: avm:rexx/sendmessageto.avm */ sendMessageTo: procedure parse arg mailbox, originMailbox, number, actualFilename, fileType, introFileName, acidName, acidNumber handle = makeUniqueFile() call initLogEntry() log.returnNumber = number log.filename = actualFilename log.type = fileType; log.returnSendFunc = 'DefaultSender' log.returnRetry = 3; log.returnInterval = 5 log.origMailbox = originMailbox log.altFileName = introFileName; log.cidName = acidName; log.cidNumber = acidNumber if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then call smNeedToRecordOut if ~exists(voiceFile(mailbox, log.altFileName)) then call smNeedToRecordIntro if log.returnNumber = '' then do; call smNeedToEnterTel(); signal sendMessageToMenu; end 'playvoice' 'avm:voices/numberToSendTo' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end call playNumber(log.returnNumber) 'flushphonebuffer' sendMessageToMenu: call aapresentmenu('avm:voices/editSendMessage', '01234#*', '3') action = result select when action = '=0' then signal sendMessageToMenu when action = '=1' then do; call playNumber(log.returnNumber); log.returnNumber = getNumber(); signal sendMessageToMenu; end when action = '=2' then do; if upper(log.type) = 'VOICE' then call recordMessage(voiceFile(mailbox, log.filename)); signal sendMessageToMenu; end when action = '=3' then do; call editIntro(); signal sendMessageToMenu; end when action = '=4' then do; if smCanSend() then do; call saveLogEntry(mailbox, handle); return 1; end; else signal sendMessageToMenu; end when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; call cleanSendMessageTo(); return 0; end when action = '=*' then do; call cleanSendMessageTo(); signal answerVoiceDone; end when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 10 then do; call cleanSendMessageTo(); signal answerVoiceDone; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end call cleanSendMessageTo(); return 0 cleanSendMessageTo: if verify(log.fileName, '/:', 'M') = 0 then address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.fileName) || '#?' if verify(log.altFileName, '/:', 'M') = 0 then address command 'delete >nil: <nil: quiet' voiceFile('Outgoing', log.altFileName) || '#?' return smNeedToRecordOut: 'playvoice' 'avm:voices/NeedToRecordOutgoing' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end 'flushphonebuffer' return smNeedToRecordIntro: 'playvoice' 'avm:voices/NeedToRecordIntro' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end 'flushphonebuffer' return smNeedToEnterTel: 'playvoice' 'avm:voices/NeedToEnterTel' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end 'flushphonebuffer' return editIntro: call aapresentmenu('avm:voices/EditIntro', '0123#*', '3') action = result select when action = '=0' then signal editIntro when action = '=1' then do; log.altFileName = voiceFile(log.origMailbox, 'Introduction'); end when action = '=2' then do; log.altFileName = makeUniqueFile(); end when action = '=3' then do; call recordMessage(voiceFile(mailbox, log.altFileName)); end when action = '=4' then nop when action = '=5' then nop when action = '=6' then nop when action = '=7' then nop when action = '=8' then nop when action = '=9' then nop when action = '=#' then do; return; end when action = '=*' then do; call cleanSendMessageTo(); signal answerVoiceDone; end when action = 4 then do; call cleanSendMessageTo(); signal stdfax; end when action = 5 then do; call cleanSendMessageTo(); signal stddata; end when action = 8 then do; call cleanSendMessageTo(); signal stdbusy; end when action = 10 then do; call cleanSendMessageTo(); signal answerVoiceDone; end when action = 12 then do; call cleanSendMessageTo(); signal stdabort; end when action = 14 then do; call cleanSendMessageTo(); signal stderror; end when action = 16 then do; call cleanSendMessageTo(); signal stderror; end otherwise signal arexxerror end signal editIntro smCanSend: if log.returnNumber = '' then do; call smNeedToEnterTel(); return 0; end if upper(log.type) = 'VOICE' & ~exists(voiceFile(mailbox, log.fileName)) then do; call smNeedToRecordOut(); return 0; end return 1 return aaCallSysop: procedure expose mailbox. mailbox calledSysop if mailbox.autoforwardscript ~= "" & mailbox.autoforward ~= "" then do calledSysop = 1 handle = makeUniqueFile() call initLogEntry(); log.origmailbox = mailbox log.filename = 'avm:voices/autoforward'; log.type = 'voice' log.returnsendfunc = mailbox.autoforwardscript; log.returninterval = 5 log.returnretry = 3; log.returnnumber = mailbox.autoforward; log.altFileName = voiceFile(mailbox, 'Introduction') call saveLogEntry('Outgoing', handle) 'playvoice' 'avm:voices/BeingForwarded' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playNumber(mailbox.autoforward) 'flushphonebuffer' end return announceForwardNumber: 'playvoice' 'avm:voices/AnnounceForward' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end call playNumber(mailbox.autoforward) 'playvoice' 'avm:voices/AnnounceAgain' action = rc select when action = 0 then nop when action = 1 then nop when action = 4 then signal stdfax when action = 5 then signal stddata when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return aaPageSysop: procedure expose mailbox. mailbox pagedSysop if mailbox.autopagescript ~= "" & mailbox.autopage ~= "" then do pagedSysop = 1 handle = makeUniqueFile() call initLogEntry(); log.origmailbox = mailbox log.filename = 'avm:voices/autoforward'; log.type = 'voice' log.returnsendfunc = mailbox.autopagescript; log.returninterval = 5 log.returnretry = 3; log.returnnumber = mailbox.autopage; log.altFileName = voiceFile(mailbox, 'Introduction') call saveLogEntry('Outgoing', handle) end return stdabort: exit stdbusy: exit stderror: exit stdtimedout: exit stdfaxinstruct: 'playvoice' 'avm:voices/FaxStarting' action = rc select when action = 0 then nop when action = 1 then do; call checkifabort; end when action = 4 then nop when action = 5 then nop when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end stdfax: faxscript = getclip(address() || 'FAXSCRIPT') if faxscript = '' then faxscript = 'handlefax' if symbol('mailbox') = 'VAR' then address rexx faxscript address() mailbox else address rexx faxscript address() 'anonymous' exit stddatainstruct: 'playvoice' 'avm:voices/DataStarting' action = rc select when action = 0 then nop when action = 1 then do; call checkifabort; end when action = 4 then nop when action = 5 then nop when action = 8 then signal stdbusy when action = 12 then signal stdabort when action = 14 then nop when action = 16 then nop otherwise signal arexxerror end stddata: datascript = getclip(address() || 'DATASCRIPT') if datascript = '' then datascript = 'handledata' if symbol('mailbox') = 'VAR' then address rexx datascript address() mailbox else address rexx datascript address() exit checkifabort: 'readnkeys' '1' '3' action = rc if action = 0 then value = result select when action = 0 then do; if value = '*' then signal stdabort; end when action = 4 then nop when action = 5 then nop when action = 8 then signal stdbusy when action = 10 then nop when action = 12 then signal stdabort when action = 14 then signal stderror when action = 16 then signal stderror otherwise signal arexxerror end return